<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1" name="viewport">

    <title>添加医生</title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    <style>
        #form {
            padding-right: 100px;
            margin-top: 150px;
            width: 40%;
        }

        #image {
            padding-left: 100px;
            padding-top: 100px;
        }
    </style>
</head>
<body background="img/background.jpg">
<div class="row">
    <img class="col-md-6" id="image" src="img/pregnant.svg"/>
    <div background-color="width" class="col-md-6" id="form">
        <div>
            <h1>医生信息查询</h1>
        </div>
        <button class="btn btn-default" onclick="window.location.href='/'" type="submit">返回</button>
        <button class="btn btn-default" id="check" onclick="return false;" type="inquiry">查询</button>
        <div id="main">

        </div>
    </div>
</div>

<script>
    $(document).ready(function () {
        $("#check").click(function () {
            //添加查询地址
            $.get("getUsers", function (data, status) {
                if (status == "success") {
                    alert("提交成功");
                    var data2 = JSON.stringify(data);
                    var obj = JSON.parse(data2);
                    html = '<table border="1"><tr> <td>id</td> <td>性别</td> <td>手机号</td> <td>邮箱</td> <td>医生姓名</td></tr>';
                    for (var i in obj) {
                        html = html + "<tr><td>" + obj[i].id + "</td><td>" + obj[i].gender + "</td><td>" + obj[i].phone + "</td><td>" + obj[i].email + "</td><td>" + obj[i].name + "</td></tr>";
                    }
                    html = html + "</table>";
                    $("#main").append(html);
                }
            });
        });
    });
</script>
</body>
</html>
